package com.sskj.gocoin.mine;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.common.base.App;
import com.sskj.common.util.ToastUtil;
import com.sskj.gocoin.MyAppLication;
import com.sskj.gocoin.R;
import com.sskj.gocoin.common.Constants;
import com.sskj.gocoin.m.HttpConfig;
import com.sskj.gocoin.m.bean.HttpData;
import com.sskj.gocoin.m.bean.ShareEntry;
import com.sskj.gocoin.m.bean.UserInfo;
import com.sskj.gocoin.m.http.JsonCallBack;
import com.sskj.gocoin.mine.data.BenefitBean;
import com.sskj.gocoin.mine.data.TuiguangBean;
import com.sskj.gocoin.p.base.BasePresenter;
import com.sskj.gocoin.utils.SPUtils;

import java.util.List;

public class BenefitPresenter extends BasePresenter<BenefitActivity> {
    /**
     * 我要费率
     */
    public void getBenefit(){
        OkGo.<HttpData<BenefitBean>>post(HttpConfig.BASE_URL + HttpConfig.BENEFIT)
                .execute(new JsonCallBack<HttpData<BenefitBean>>(this) {
                    @Override
                    protected void _onSuccess(Response<HttpData<BenefitBean>> response) {
                        HttpData<BenefitBean> httpData = response.body();
                        if (httpData.getCode() == 200) {
                            mView.onGetBenefit(httpData.getData());
                        }
                    }
                });
    }

    public void getTuiGuang(){
        OkGo.<HttpData<TuiguangBean>>post(HttpConfig.BASE_URL + HttpConfig.TUIGUANG)
                .execute(new JsonCallBack<HttpData<TuiguangBean>>(this) {
                    @Override
                    protected void _onSuccess(Response<HttpData<TuiguangBean>> response) {
                        HttpData<TuiguangBean> httpData = response.body();
                        if (httpData.getCode() == 200) {
                            mView.onGetTuiguang(httpData.getData());
                        }
                    }
                });
    }
}
